var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var ResKeeper = require("AA_ResKeeper");
var Excel = require("AA_Excel");
var GameGlobalVariable = require("AA_GameGlobalVariable");
var NodePoolMag = require("AA_NodePoolMag");
var UI_MosterLogic = require("AA_UI_MosterLogic");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_FanWeiDong = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.bingdongani = null;
    t.nowplayer = null;
    t.nowbuffdata = null;
    t.nowtime = 0;
    t.nowmoster = [];
    t.nowattack = 0;
    t.offtime = 0;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.playBingDong = function (e, t, o) {
    var n = this;
    this.nowbuffdata = Excel.Excel.shuiguobuff(85);
    this.nowtime = this.nowbuffdata.bufftime;
    this.nowplayer = t;
    this.nowattack = o;
    e.forEach(function (e) {
      var i = e.getComponent(UI_MosterLogic.default);
      i.addDongJie(n.nowtime);
      var a = o + o * (n.nowbuffdata.value[1] / 100);
      i.fujiaAttack(a, 1, t);
    });
    this.bingdongani = this.node.children[0].getComponent(dragonBones.ArmatureDisplay);
    this.bingdongani.playAnimation("dong", 1);
    this.nowmoster = e;
  };
  _creator.prototype.baolie = function () {
    var e = this;
    this.nowmoster.forEach(function (t) {
      var o = t.getComponent(UI_MosterLogic.default);
      if (o.fanweidong) {
        var n = e.nowattack + e.nowattack * (e.nowbuffdata.value[2] / 100);
        o.fujiaAttack(n, 1, e.nowplayer);
      }
      e.bingdongani.playAnimation("kai", 1);
      e.scheduleOnce(function () {
        NodePoolMag.NodePoolMag.instance.recycleNode("fanweidong", e.node);
      }, .5);
    });
  };
  _creator.prototype.update = function (e) {
    if (!GameGlobalVariable.GameGlobalVariable.gamepuase) {
      if (this.nowtime > 0) {
        this.offtime += e;
        if (this.offtime >= 1) {
          this.nowtime -= 1;
          this.nowtime <= 0 && this.baolie();
          this.offtime = 0;
        }
      }
      var t = GameGlobalVariable.GameGlobalVariable.mosterNode.children;
      var o = [];
      for (var n = 0; n < t.length; n++) {
        var i = t[n];
        i.getComponent(UI_MosterLogic.default).isdongjie || o.push(i);
      }
      for (n = 0; n < o.length; n++) {
        var a = o[n];
        var r = this.node.x - this.node.width / 2;
        var c = this.node.x + this.node.width / 2;
        var s = this.node.y - this.node.height / 2;
        var l = this.node.y + this.node.height / 2;
        r < a.x && a.x < c && a.y > s && a.y < l && a.getComponent(UI_MosterLogic.default).setJianShu(this.nowbuffdata.value[3] / 100, this.nowbuffdata.value[4], this.nowplayer);
      }
    }
  };
  __decorate([_property(dragonBones.ArmatureDisplay)], _creator.prototype, "bingdongani", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UI_FanWeiDong;